package com.lucenly.card.adapter;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lucenly.card.R;
import com.lucenly.card.bean.MsgBean;
import com.lucenly.card.utils.DensityUtil;
import com.siberiadante.toastutils.ToastUtil;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by jameson on 8/30/16.
 */
public class CardAdapter extends BaseQuickAdapter<MsgBean,BaseViewHolder> {

    public CardAdapter(){
        super(R.layout.item_card);
    }

    @Override
    protected void convert(BaseViewHolder helper, MsgBean item) {
        CardView ll_item = helper.getView(R.id.ll_item);
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ll_item.getLayoutParams());
        if(helper.getAdapterPosition()%2!=0){
            lp.setMargins(DensityUtil.dp2px(5),0,0,0);
        }else{
            lp.setMargins(0,0,DensityUtil.dp2px(5),0);
        }
        ll_item.setLayoutParams(lp);
    }
}
